home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-04-01 | 3.5 KB | 175 lines | [TEXT/MPS ] |
- *
- * PatchLMgr.a
- *
- * Created Thursday, March 31, 1988 5:22:58 PM
- *
-
- Case On
- Print Off
-
- Include 'Traps.a'
- Include 'PackMacs.a'
- Include 'SysEqu.a'
- Include 'ToolEqu.a'
-
- Print On
-
- Pack0Trap Equ $A9E7
- ScrRctTrap Equ $A8EF
-
- LUpFrame Record {return},decr
- theRgn DS.L 1 ; Region to redraw
- lHandle DS.L 1 ; Handle to the list
- selector DS.W 1 ; MUST BE 100
- return DS.L 1 ; Return address
- paramSize Equ theRgn - *
- EndR
-
- ScRectFrame Record {return},decr
- r DS.L 1
- dh DS.W 1
- dv DS.W 1
- updateRgn DS.L 1
- return DS.L 1
- paramSize Equ r - *
- EndR
-
- LUpPatch Proc Export
- With LUpFrame
-
- Cmp.W #lUpdate, selector(SP)
- Beq.S DoYourStuff
- Move.L ApplScratch, A0
- Jmp (A0)
-
- ; What We Want:
- ;
- ; Before After
- ; ====== =====
- ; Caller's return (SP) selector
- ; " 2(SP) lHandle
- ; selector 4(SP) "
- ; lHandle 6(SP) theRgn
- ; " 8(SP) "
- ; theRgn 10(SP) lHandle
- ; " 12(SP) "
- ; Don't care 14(SP) theRgn
- ; " 16(SP) "
- ; " 18(SP) Caller's return
- ; " 20(SP) "
- ; ETC.
- ; The stack _was_ 14 bytes deep; it is to be 22 bytes deep.
-
-
- DoYourStuff Lea selector(SP), A0 ; Re-push the arguments:
- Move.L (SP), D0 ; Keep the return address
- Lea -8(SP), SP ; Make room two longs
- Move.L SP, A1 ; A1 is destination
- Move.W (A0)+, (A1)+ ; selector
- Move.L (A0)+, (A1)+ ; lHandle
- Move.L (A0), (A1)+ ; theRgn
- Lea 2(SP), A0 ; Point to lHandle again.
- Move.L (A0)+, (A1)+ ; lHandle
- Move.L (A0), (A1)+ ; theRgn
- Move.L D0, (A1) ; return address
-
- Move.L ApplScratch, A0
- Jsr (A0) ; Call the real LUpdate
-
- Import LUpdatePatch
- Jsr LUpdatePatch
- Lea 8(SP), SP ; Remove the arguments
- Rts ; Return to caller
-
- EndWith
-
- Entry ScrRctPat
- ScrRctPat
- With ScRectFrame
- Clr.W -(SP)
- _SetResLoad ; Don't force a load
-
- Clr.L -(SP)
- Move.L #'PACK', -(SP)
- Clr.W -(SP)
- _GetResource ; Get handle to PACK 0
-
- Move.L #1, D0
- Move.B D0, -(SP) ; (Previous result still on stk)
- _SetResLoad ; Enable rsrc loading.
-
- Move.L (SP)+, D0 ; Examine PACK 0 handle
- Beq.S @0 ; No business if no resource
-
- Move.L D0, A1 ; A1 has original handle
- Move.L (A1), D0 ; Master pointer
- _StripAddress ; Strip flag bits
- Tst.L D0 ; Examine Addr(PACK 0)
- Beq.S @0 ; No business if not loaded
-
- Move.L (SP), D1 ; caller's address
- Sub.L D0, D1 ; D1 <- offset of call in PACK
- Blt.S @0 ; No business if below PACK
-
- Move.L A1, A0
- _GetHandleSize
-
- Cmp.L D0, D1 ; Offset > size of PACK?
- Bgt.S @0 ; Yes. not interested.
-
- ; By here, we have verified that ScrollRect was called by the
- ; List Manager.
-
- Import MYSCRRECT
- Lea MYSCRRECT, A0
- Bra.S @1 ; Continue with my patch.
-
- @0 Move.L ApplScratch+8, A0 ; Continue with ScrRect
- @1 Jmp (A0)
-
- EndWith
-
- Entry LUPatOut
- LUPatOut Move.W #Pack0Trap, D0 ; Pack 0
- Move.L ApplScratch, A0 ; Restore old address.
- _SetTrapAddress
-
- Move.W #ScrRctTrap, D0
- Move.L ApplScratch+8, A0 ; Restore old address.
- _SetTrapAddress
-
- Move.L ApplScratch+4, IAZNotify
- ; Get the saved IAZNotify
- Beq.S @0 ; If NULL, don't call it
- Move.L IAZNotify, A0
- Jmp (A0) ; Jump right to it.
-
- @0 Rts
-
- Export LUPatIn
- LUPatIn Move.W #Pack0Trap, D0
- _GetTrapAddress
- Move.L A0, ApplScratch ; Save the trap addr in ApplScratch
-
- Move.W #ScrRctTrap, D0
- _GetTrapAddress
- Move.L A0, ApplScratch+8 ; Save the trap addr in ApplScratch
-
- Move.L IAZNotify, ApplScratch+4
- ; Keep the old IAZNotify pointer
- Lea LUPatOut, A0
- Move.L A0, IAZNotify ; Install our trap-removal routine
-
- Lea LUpPatch, A0
- Move.W #Pack0Trap, D0
- _SetTrapAddress ; Install our Pack0
-
- Lea ScrRctPat, A0
- Move.W #ScrRctTrap, D0
- _SetTrapAddress ; Install our ScrollRect
- Rts
-
- EndProc
-
- End
-